function Box(parent, option) {
	// 防止用户输入错误
	option = option || {};
	this.x = option.x || 0;
	this.y = option.y || 0;
	this.width = option.width || 20;
	this.height = option.height || 20;
	this.background = option.background || 'red';
	this.div = parent;

	// 创建一个盒子在div中
	this.box = document.createElement('div');
	this.box.style.width = this.width + 'px';
	this.box.style.height = this.height + 'px';
	this.box.style.background = this.background;
	this.box.style.position = 'absolute';
	this.box.className = 'box';
	div.appendChild(this.box);
	this.init();
}
Box.prototype = {
	constructor: Box,
	randomXy: function() {
		let div = this.div;
		let box = this.box;
		let x = Tools.getRandom(0, div.offsetWidth / this.width);
		let y = Tools.getRandom(0, div.offsetHeight / this.height);
		box.style.left = x * this.width + 'px';
		box.style.top = y * this.height + 'px';
	},
	randomColor: function() {
		let a = Tools.getRandom(0, 255);
		let b = Tools.getRandom(0, 255);
		let c = Tools.getRandom(0, 255);
		this.box.style.background = 'rgb('+a+', '+b+', '+c+')';
	},
	init: function() {
		this.randomXy();
		this.randomColor();
	}
}